﻿<navigation:Page x:Class="Silverlight.Controls.ToolTips.Demo.Home"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:controls="clr-namespace:Silverlight.Controls.ToolTips;assembly=Silverlight.Controls.ToolTips"
                 xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
                 xmlns:ValueConverters="clr-namespace:Silverlight.Controls.ToolTips.Demo.ValueConverters"
                 xmlns:Model="clr-namespace:Silverlight.Controls.ToolTips.Demo.Model"
                 xmlns:Views="clr-namespace:Silverlight.Controls.ToolTips.Demo.Views"
                 mc:Ignorable="d"
                 d:DesignWidth="640"
                 d:DesignHeight="480"
                 Title="Home"
                 Style="{StaticResource PageStyle}">
    <navigation:Page.Resources>
        <!-- Some static data for the tooltip datacontext -->
        <Model:AssemblyVersionInfo x:Key="PersonDataContext"
                                   FullName="Silverlight.Controls.ToolTips.dll"
                                   Version="2.1.0" />

        <!-- ToolTip Value Converter -->
        <ValueConverters:DurationToDoubleConverter x:Key="DoubleToDurationConverter" />
    </navigation:Page.Resources>
    <Grid>
        <ScrollViewer Style="{StaticResource PageScrollViewerStyle}">
            <StackPanel>
                <TextBlock Style="{StaticResource HeaderTextStyle}"
                           Text="Home" />
                <TextBlock Style="{StaticResource ContentTextStyle}"
                           Text="Use this page to test some of the advanced features provided by the Silverlight.Controls.ToolTips assembly you found on Codeplex." />
                <Grid Margin="0,10,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="128" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="imageButton"
                            Grid.Column="0"
                            Click="OnButtonClicked"
                            Style="{StaticResource ImageButtonStyle}"
                            Width="128"
                            Height="128"
                            Cursor="Hand"
                            MouseEnter="OnButtonMouseEnter"
                            MouseLeave="OnButtonMouseLeave">
                        <controls:ToolTipService.ToolTip>
                            <controls:ToolTip x:Name="tooltipControl"
                                              Style="{StaticResource ToolTipStyle}"
                                              Opened="OnToolTipOpened"
                                              Closed="OnToolTipClosed">
                                <controls:ToolTip.CloseAnimation>
                                    <Storyboard Duration="00:00:01">
                                        <DoubleAnimation From="1"
                                                         To="0"
                                                         Storyboard.TargetName="tooltipControl"
                                                         Storyboard.TargetProperty="Opacity" />
                                    </Storyboard>
                                </controls:ToolTip.CloseAnimation>
                                <controls:ToolTip.OpenAnimation>
                                    <Storyboard Duration="00:00:01">
                                        <DoubleAnimation From="0"
                                                         To="1"
                                                         Storyboard.TargetName="tooltipControl"
                                                         Storyboard.TargetProperty="Opacity" />
                                    </Storyboard>
                                </controls:ToolTip.OpenAnimation>
                                <controls:ToolTip.Content>
                                    <StackPanel Margin="5">
                                        <TextBlock Text="This tooltip has a configurable duration and delay." />
                                        <TextBlock Text="Click the image to disable the button and make the tooltip disappear." />
                                        <TextBlock Text="The contents below are databound." />
                                        <StackPanel Orientation="Horizontal"
                                                    Margin="0,5,0,0">
                                            <TextBlock Text="Assembly: "
                                                       FontWeight="Bold"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Center" />
                                            <TextBlock Text="{Binding Path=FullName, Source={StaticResource PersonDataContext}}"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Center" />
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal"
                                                    Margin="0,0,0,0">
                                            <TextBlock Text="Version: "
                                                       FontWeight="Bold"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Center" />
                                            <TextBlock Text="{Binding Path=Version, Source={StaticResource PersonDataContext}}"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Center" />
                                        </StackPanel>
                                    </StackPanel>
                                </controls:ToolTip.Content>
                            </controls:ToolTip>
                        </controls:ToolTipService.ToolTip>
                    </Button>
                    <StackPanel Grid.Column="1"
                                Margin="10,5">
                        <TextBlock Style="{StaticResource ContentTextStyle}"
                                   Text="Hover your mouse over the image on the left to see a persistent ToolTip with databound content." />
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="50" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition Height="10" />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <TextBlock Text="Delay in seconds: "
                                       Style="{StaticResource ContentTextStyle}" />
                            <toolkit:NumericUpDown x:Name="InitialDelay"
                                                   Grid.Column="1"
                                                   DecimalPlaces="1"
                                                   Increment="0.1"
                                                   Value="{Binding Path=InitialDelay, ElementName=tooltipControl, Converter={StaticResource DoubleToDurationConverter}, Mode=TwoWay}" />

                            <TextBlock Grid.Row="1"
                                       Style="{StaticResource ContentTextStyle}"
                                       Text="Display time in seconds: " />
                            <toolkit:NumericUpDown x:Name="DisplayTime"
                                                   Grid.Column="1"
                                                   Grid.Row="1"
                                                   DecimalPlaces="1"
                                                   Increment="0.1"
                                                   Value="{Binding Path=DisplayTime, ElementName=tooltipControl, Converter={StaticResource DoubleToDurationConverter}, Mode=TwoWay}" />
                            <CheckBox x:Name="PersistentToolTip"
                                      Grid.Column="2"
                                      Grid.Row="1"
                                      Margin="5,0,0,0"
                                      VerticalContentAlignment="Center"
                                      VerticalAlignment="Center"
                                      Content="Persistent"
                                      Checked="OnPersistentToolTipChecked"
                                      Unchecked="OnPersistentToolTipUnchecked" />

                            <TextBlock Text="Click the image to disable the button and make the tooltip disappear."
                                       Style="{StaticResource ContentTextStyle}"
                                       Grid.Row="3"
                                       Grid.ColumnSpan="3" />
                            <StackPanel Orientation="Horizontal"
                                        Grid.Row="4"
                                        Grid.ColumnSpan="3"
                                        HorizontalAlignment="Left">
                                <Button x:Name="resetDefaultsButton"
                                        Content="Set Defaults"
                                        Width="150"
                                        HorizontalAlignment="Left"
                                        Click="OnButtonResetDefaultsClicked"
                                        Margin="0,0,10,0" />
                                <Button x:Name="enableImageButton"
                                        Content="Re-enable image button"
                                        Visibility="Collapsed"
                                        Width="150"
                                        HorizontalAlignment="Left"
                                        Click="OnEnableImageButtonClicked" />
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                </Grid>
                <Border Margin="50,125,50,50"
                        Padding="10"
                        BorderBrush="Black"
                        BorderThickness="1">
                    <Border.Background>
                        <SolidColorBrush Color="Silver" />
                    </Border.Background>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition Height="16" />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <TextBlock Text="Open animation: "
                                   Style="{StaticResource ContentTextStyle}" />
                        <TextBlock x:Name="OpenAnimationDuration"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Column="1" />

                        <TextBlock Text="Display time: "
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="1" />
                        <TextBlock x:Name="DisplayTimeDuration"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Column="1"
                                   Grid.Row="1" />

                        <TextBlock Text="Close animation: "
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="2" />
                        <TextBlock x:Name="CloseAnimationDuration"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Column="1"
                                   Grid.Row="2" />

                        <TextBlock Text="MouseEnter time: "
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="4" />
                        <TextBlock x:Name="MouseEnterDuration"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="4"
                                   Grid.Column="1" />

                        <TextBlock Text="Initial delay: "
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="5" />
                        <TextBlock x:Name="DelayDuration"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Column="1"
                                   Grid.Row="5" />

                        <TextBlock Text="Total tooltip time: "
                                   FontWeight="Bold"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Row="6" />
                        <TextBlock x:Name="TotalToolTipDuration"
                                   FontWeight="Bold"
                                   Style="{StaticResource ContentTextStyle}"
                                   Grid.Column="1"
                                   Grid.Row="6" />

                        <Views:ToolTipLifeTimeVisualizer x:Name="tooltipLifeTimeVisualizer"
                                                         Grid.Column="2"
                                                         Grid.RowSpan="7" />
                    </Grid>
                </Border>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</navigation:Page>